﻿let isOtherLogin = false;//是否在为别的网站提供登录
let redirect = "";//登录后重定向的地址，可以是本网站的也可以是别的网址，别的网址应该以http打头
let otherQuery = "";//页面传参
let siteTitle = "VueDemo";//网站标题
let siteLogo = "https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png";//logo图片路径
let LayoutMounted = false;//layout Mounted
let hasSystemPage = false;//是否有固定的系统主页，系统主页的路径规定为：/dashboard name为Dashboard
httpVueLoader.debug = true;//在httpVueLoader中打印信息
const Layout = () => httpVueLoaderWrap("/vue/layout/index.vue ");//布局组件
const login = () => httpVueLoaderWrap("/vue/views/login/index.vue");//登录组件
String.prototype.trimAndTolower = function () {
	return this.replace(/\s/g, '').toLowerCase();
}	
function LinkCssOrScss(src, isScss) {
	var _src = !isScss ? src : "/nodejs/importscssfile?file=" + src;
	_src = _src.trimAndTolower();
	if (LinkCssOrScss.Linked.indexOf(_src) === -1) {
		LinkCssOrScss.Linked += ";" + _src;
		$("<link rel='stylesheet' type='text/css' />").attr("href", _src).appendTo("body");
	}
}
LinkCssOrScss.Linked = "";
function LoadScript(src) {
	var _src = src.trimAndTolower();
	if (LoadScript.Loaded.indexOf(_src) === -1) {
		LoadScript.Loaded += ";" + _src;
		$("<script type='text/javascript' />").attr("src", src).appendTo("body");
	}
}
LoadScript.Loaded = "";
function LoadScriptThen(src) {
	var _src = src.trimAndTolower();
	return new Promise(function (resolve, reject) {
		if (LoadScript.Loaded.indexOf(_src) === -1) {
			LoadScript.Loaded += ";" + _src;
			var xhr = new XMLHttpRequest();
			xhr.open('GET', _src);

			xhr.onreadystatechange = function () {

				if (xhr.readyState === 4) {

					if (xhr.status >= 200 && xhr.status < 300) {
						$("<script type='text/javascript' />").text(xhr.responseText).appendTo("body");
						resolve(null);
					}
					else {
						reject(xhr.status);
					}
				}
			};

			xhr.send(null);
		}
		else {
			resolve(null);
		}
	});
}